home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Graphics / Pyramid / Source / matrix.h < prev    next >
C/C++ Source or Header  |  1993-09-15  |  1KB  |  60 lines

  1. /*    matrix.h - matrix algebra definitions
  2.  *    Copyright (C) 1993 Corona Design, Inc. All rights reserved.
  3.  *
  4.  *    Abstract
  5.  *        Common algebraic manipulations of 4X4 matrices and vectors.
  6.  *        Reference: Foley & van Dam, Computer Graphics
  7.  *    Requires C++ compiler.
  8.  *
  9.  *    $LOG
  10.  */
  11.  
  12. #ifndef    _MATRIX_H
  13. #define    _MATRIX_H
  14.  
  15.                                 // a homogenous 3D vector
  16. typedef struct _vector
  17.     {
  18.     float    x;
  19.     float    y;
  20.     float    z;
  21.     float    w;
  22.                                 //operations
  23.             float     vectorLength();
  24.                                 // V = V X W
  25.             void    crossProduct( struct _vector *);
  26.                                 // V = M * V
  27.             void    matrixMultiply( struct _matrix *);
  28.                                 // V = V * k
  29.             void    scalarMultiply( float k);
  30.     } VECTOR;
  31.  
  32.  
  33.                                 // 4 X 4 matrix
  34. struct _matrix
  35.     {
  36.     float    matrix[4][4];
  37.                                 // retrieve rotation vectors
  38.             struct _vector *getRx();
  39.             struct _vector *getRy();
  40.             struct _vector *getRz();
  41.                                 // A *= B
  42.             void    matrixMultiply( struct _matrix *B);
  43.     };
  44.  
  45.  
  46.                                 // constant identity elements
  47. extern    VECTOR            unitVector;
  48. extern    struct _matrix    unitMatrix;
  49.  
  50.  
  51. #ifdef    _LOG
  52. /*
  53.  *    $Log:    matrix.h,v $
  54.  * Revision 1.1  93/09/15  12:33:57  pkron
  55.  * Created
  56.  * 
  57.  */
  58. #endif        
  59.  
  60. #endif    // MATRIX_H